#!/bin/bash

echo "=== Interactive Database Isolation Test ==="

# Create a test script for interactive mode
cat > /tmp/interactive_test_commands << 'EOF'
SHOW TABLES;
CREATE DATABASE testdb2;
SHOW DATABASES;
USE testdb2;
SHOW TABLES;
CREATE TABLE testdb2_exclusive (id INTEGER, name TEXT);
SHOW TABLES;
USE gudb;
SHOW TABLES;
USE testdb2;
SHOW TABLES;
quit
EOF

echo "Running commands in single interactive session:"
echo "---"
cat /tmp/interactive_test_commands
echo "---"

# Run all commands in a single interactive session
./bin/gu -h localhost -P 7777 -u admin -i < /tmp/interactive_test_commands

# Cleanup
rm -f /tmp/interactive_test_commands

echo "=== Interactive Test Complete ==="